unit uRights;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, ExtCtrls, Buttons;

type
  TfrmUsersList = class(TForm)
    Label1: TLabel;
    rgFolders: TRadioGroup;
    lvObjects: TListView;
    lvUsers: TListView;
    btnAdd: TBitBtn;
    btnEdit: TBitBtn;
    btnDelete: TBitBtn;
    chkDeleted: TCheckBox;
    procedure FormShow(Sender: TObject);
    procedure chkDeletedClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure FillForm;
  end;

var
  frmUsersList: TfrmUsersList;

implementation

uses uDM, StrUtils;

{$R *.dfm}

procedure TfrmUsersList.chkDeletedClick(Sender: TObject);
begin
  FillForm;
end;

procedure TfrmUsersList.FillForm;
begin
  dmData.qryUsers.SQL.Text := 'Select * from Users Where DELETED = :Is';
  dmData.qryUsers.ParamByName('Is').AsBoolean := chkDeleted.Checked;
  dmData.qryUsers.Active := True;
  dmData.qryUsers.First;
  lvUsers.Items.Clear;
  while not dmData.qryUsers.Eof do
  begin
    with lvUsers.Items.Add do
    begin
      Caption := dmData.qryUsers.FieldByName('LOGN').AsString;
      if dmData.qryUsers.FieldByName('LOGN').AsBoolean then
        SubItems.Add('+')
      else
        SubItems.Add('');
    end;
    dmData.qryUsers.Next;
  end;
end;

procedure TfrmUsersList.FormShow(Sender: TObject);
begin
  FillForm;
end;

end.
